<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title></title>
	<meta name="keywords" content="">
	<meta name="description" content="">
<head>
	<link rel="stylesheet" href="/css/bootstrap.min.css" />
	<!--bootstrap图片上传插件  -->
	<link href="/fileinput/fileinput.min.css" rel="stylesheet">
	<!--风格css框架  -->
	<link href="/fileinput/theme.css" rel="stylesheet">
	<!--图标字体框架  -->
	<link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
	<link href="/css/layui.css" rel="stylesheet">
      <style>
			.kv-avatar .krajee-default.file-preview-frame,.kv-avatar .krajee-default.file-preview-frame:hover {
			    margin: 0;
			    padding: 0;
			    border: none;
			    box-shadow: none;
			    text-align: center;
			}
			.kv-avatar {
			    display: inline-block;
			}
			.kv-avatar .file-input {
			    display: table-cell;
			    width: 213px;
			}
			.kv-reqd {
			    color: red;
			    font-family: monospace;
			    font-weight: normal;
			}
       </style>
	
</head>
<body class="gray-bg">
	<div id="kv-avatar-errors-2" class="center-block" style="width:800px;display:none"></div>
    <div class="row">
        <div class="col-sm-4 text-center">
            <div class="kv-avatar">
                <div class="file-loading">
                    <input id="img" name="img" type="file" required>
                </div>
            </div>
        </div>
      </div>

 
		<!-- 全局js -->
	<script src="/js/jquery.min.js?v=2.1.4"></script>
	<script src="/js/bootstrap.min.js?v=3.3.6"></script>
	<script type="text/javascript" src="/fileinput/fileinput.min.js"></script>  <!--bootstrap图片上传插件  -->
	<script type="text/javascript" src="/fileinput/theme.js"></script>   <!--风格  -->
	<script type="text/javascript" src="/fileinput/zh.js"></script>      <!--汉化  -->
	<script src="/js/plugins/layer/layer.js"></script>   <!--layer弹框js  -->
	
<script th:inline="javascript">
		$("#img").fileinput({
			language: "zh",  //国际化
	        theme: 'fa',  //显示主题
			uploadAsync: true, //是否允许异步上传
			enctype: 'multipart/form-data',
		    uploadUrl: '/system/company/editLogo/?id='+[[${id}]]+'', // 上传的地址
		    overwriteInitial: true,
		    showUpload: true, //是否显示上传按钮
		    maxFileSize: 2048,
		    layoutTemplates :{
	            // actionDelete:'', //去除上传预览的缩略图中的删除图标
	            actionUpload:'',//去除上传预览缩略图中的上传图片；
	            //actionZoom:''   //去除上传预览缩略图中的查看详情预览的缩略图标。
	        },
		    showClose: false,
		    showCaption: false,
		    showBrowse: false,
		    browseOnZoneClick: true,
		    removeLabel: '',
		    removeIcon: '<i class="glyphicon glyphicon-remove"></i>',
		    removeTitle: '取消或重置更改',
		    elErrorContainer: '#kv-avatar-errors-2',
		    msgErrorClass: 'alert alert-block alert-danger',
		    defaultPreviewContent: '<img src="'+[[${logoUrl}]]+'" alt="Your Avatar"><h6 class="text-muted">点击这里修改<上传图片不能超过2M></h6>',
		    allowedFileExtensions: ["jpg", "png", "gif"]
		}).on("fileuploaded", function(event, data) {
			if(data.response.code == 0){
				parent.layer.msg(data.response.msg);
				parent.reLoad();
				var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
				parent.layer.close(index);
			}else{
				parent.layer.msg(data.response.msg);
			}    
	    });
</script>

</body>
</html>
